import java.util.Arrays;

import java.util.Scanner;
abstract class Shape{
	public static double PI=3.14;
	public abstract double getPerimeter();
	public abstract double getArea();
		}

class Rectangle extends Shape{
	private int width;
	private int length;
public Rectangle(int width,int length){
		this.width=width;
		this.length=length;
	}
	public double getPerimeter(){
		return 2*(width+length);
	}
	public double getArea(){
		return width*length;
	}
	public String toString() {
		return "Rectangle [width=" + width + ", length=" + length + "]";
	}
}

class Circle extends Shape{
	private int radius;
	
	public Circle(int radius){
		this.radius=radius;
	}
	public double getPerimeter(){
		return 2*Shape.PI*radius;
	}
	public double getArea(){
		return Shape.PI*radius*radius;
	}
	@Override
	public String toString() {
		return "Circle [radius=" + radius + "]";
	}
}
public class Main {
	public static double sumAllPerimeter(Shape[] per) {
		double sumPer=0;
	for(int i=0;i<per.length;i++){
		sumPer= sumPer+per[i].getPerimeter();
	}
	return sumPer;

	}
	
	public static double sumAllArea(Shape[] area) {
		double sumArea=0;
		for(int i=0;i<area.length;i++){
			sumArea= sumArea+area[i].getArea();
		}
		return sumArea;
}
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		Shape[] shape=new Shape[n];
		for(int i=0;i<n;i++){
			String str=input.next();
			if(str.equals("rect")){
				shape[i]=new Rectangle(input.nextInt(),input.nextInt());
			}if(str.equals("cir")){
				shape[i]=new Circle(input.nextInt());
			}

		}
		System.out.println(sumAllPerimeter(shape));
		System.out.println(sumAllArea(shape));
		System.out.println(Arrays.toString(shape));
		for (int i= 0; i < n; i++) {
			System.out.println(shape[i].getClass() + "," + shape[i].getClass().getSuperclass());
		}
		
	}

}
